<!DOCTYPE html>
<html lang="en">
    <head>
        <%- include('../../../_global/baseLibs') %>
        <script type="text/javascript" src="/static/lib/util.js"></script>

        <title>意见反馈</title>
        <script>

            var page_advice = (function($, page_advice){
                var uri_service_saveYjfk = '/api/gzd/yjfk/saveYjfk';
                page_advice.init = function(){
                    $(".qd-btn").on('click', submitAdvice);
                }
                return page_advice;

                function submitAdvice(){
                    if(check()){
                        var params = {};
                        var text = $(".content-box").val();
                        var lxfs = $(".input-text").val();
                        params["opinion"] = text;
                        params["phoneNumber"] = lxfs;
                        params["identity"] = "0";
                        $.QuickRemote.AjaxJson({
                            funcName: uri_service_saveYjfk
                            ,params: params
                            ,callback: yjfkYsHandler
                        });
                    }
                }
                function yjfkYsHandler(result) {
                    layer.open({
                        content: '问题反馈成功'
                        , skin: 'msg'
                        , time: 1 //2秒后自动关闭
                        , end: function () {           //关闭弹出层触发
                            $.pageSwitch.goToUrl("selfCenter","personal",null,{animate:"pop",noRefresh:true});
                        }
                    })
                }

                function check(){
                    var text = $(".content-box").val();
                    var lxfs = $(".input-text").val();
                    if(!checkNotNull(text)){
                        layer.open({
                            content: '请输入反馈内容！',
                            icon: 5,
                            time:2,
                            skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
                        });
                        return false;
                    }
                    if(!checkNotNull(lxfs)){
                        layer.open({
                            content: '请输入联系方式！',
                            icon: 5,
                            time:2,
                            skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
                        });
                        return false;
                    }else{
                        var dhhm =/^1[3|4|5|7|8][0-9]{9}$/;;//电话校验
                        var yx = /^[\da-zA-z]+(@){1}[\da-zA-Z]+\.{1}[\da-zA-Z]+$/;//邮箱校验

                        if(!(dhhm.test(lxfs) || yx.test(lxfs))){
                            layer.open({
                                content: '请输入正确的联系方式！',
                                icon: 5,
                                time:2,
                                skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
                            });
                            return false;
                        }
                    }
                    return true;
                }
            })(jQuery, {});
        </script>
    </head>
    <body>
        <section class="page-wrap feedback-page">
            <header id="header" class="header-box grey fixed" >
                <div class="header-content">
                    <div class="left-tool">
                        <a class="back" href="javascript:void(0)"><i class="iconfont icon-back"></i></a>
                    </div>
                    <div class="title">意见反馈</div>
                </div>
            </header>

            <div class="title-box">请输入您的宝贵意见：</div>
            <div class="content-box-out">
                <textarea class="content-box"></textarea>
            </div>
            <div class="title-box">联系方式：</div>
            <div class="input-box-out">
                <input class="input-text" placeholder="请输入您的手机号或邮箱">
            </div>
            <div class="qd-btn-box">
                <a class="qd-btn">提交</a>
            </div>
        </section>
    </body>
</html>